<?php

class ErrorDefine
{
	const SYSTEM_ERROR						= 1000;
	const DATABASE_ERROR					= 1001;

	const ILLEGALL_URI						= 10000;
	const INVALID_TOKEN						= 10001;
	const SHORT_OF_MOBILE					= 10002;
	const INVALID_MOBILE					= 10003;
	const REQUIRED_FIELD_EMPTY				= 10026;
	const REQUEST_TOO_OFTEN					= 10004;
	const GET_VERIFY_CODE_FAILED			= 10005;
	const INVALID_VERIFY_CODE				= 10006;
	const EXPIERD_VERIFY_CODE     			= 10007;
	const EMPTY_POST_DATA					= 10008;
	const DATA_DECODE_FAILED				= 10009;
	const SHORT_OF_UTYPE					= 10010;
	const INVALID_UTYPE						= 10011;
	const SHORT_OF_VERIFY_CODE				= 10012;
	const ILLEGAL_VERIFY_CODE				= 10013;
	const SHORT_OF_PASSWORD					= 10014;
	const ILLEGAL_PASSWORD					= 10015;
	const PASSWORD_TOO_SHORT				= 10016;
	const INSERT_TABLE_FAILED				= 10017;
	const PASSWORD_TOO_LONG					= 10018;
	const UPDATE_TABLE_FAILED				= 10019;
	const MOBILE_NOT_EXIST					= 10020;
	const PASSWORD_NOT_CORRECT				= 10021;
	const SHORT_OF_TOKEN					= 10022;
	const REQUIRED_FIELD_EMPTY				= 10023;
	const INCORRECT_FIELD_FORMAT			= 10024;
	const USER_NOT_EXIST					= 10025;
	const LOGIN_FAILED						= 10026;
	const LOGOUT_FAILED						= 10027;
	const SHORT_OF_PARAMETER				= 10028;
	const SELECT_TABLE_FAILED				= 10029;
	const IVLALID_TIME_FORMAT				= 10030;
	const INVALID_USER_ID					= 10031;
	
	static $arrErrorMessage = array(
			self::SYSTEM_ERROR						=> '系统错误',
			self::DATABASE_ERROR					=> '数据库错误',

			self::ILLEGALL_URI						=> '非法URI',
			self::INVALID_TOKEN						=> '账号在其他地方登录，请重新登录！',
			self::SHORT_OF_MOBILE					=> '缺少mobile字段',
			self::INVALID_MOBILE					=> '无效的手机号码',
			self::REQUEST_TOO_OFTEN 			   	=> '请求过于频繁，请稍后再试',
			self::GET_VERIFY_CODE_FAILED			=> '获取验证码失败，请重新获取',
			self::INVALID_VERIFY_CODE				=> '验证码不正确，请重新填写',
			self::EXPIERD_VERIFY_CODE				=> '验证码已经过期，请重新获取',
			self::EMPTY_POST_DATA					=> 'Post数据为空',
			self::DATA_DECODE_FAILED				=> 'Post数据解析失败',
			self::SHORT_OF_UTYPE					=> '缺少utype字段',
			self::INVALID_UTYPE						=> '非法的utype',
			self::SHORT_OF_PASSWORD					=> '缺少password字段',
			self::ILLEGAL_PASSWORD					=> '非法的密码',
			self::PASSWORD_TOO_SHORT				=> '密码长度小于6位',
			self::PASSWORD_TOO_LONG					=> '密码长度大于15位',
			self::INSERT_TABLE_FAILED				=> '插入数据表失败',
			self::UPDATE_TABLE_FAILED				=> '更新数据表失败',
			self::MOBILE_NOT_EXIST					=> '手机用户不存在',
			self::PASSWORD_NOT_CORRECT				=> '密码不正确',
			self::SHORT_OF_TOKEN					=> '缺少token字段',
			self::REQUIRED_FIELD_EMPTY				=> '必填字段为空',
			self::INCORRECT_FIELD_FORMAT			=> '字段格式不正确',
			self::USER_NOT_EXIST					=> '用户不存在',
			self::LOGIN_FAILED						=> '登录失败',
			self::LOGOUT_FAILED						=> '退出登录失败',
			self::SHORT_OF_PARAMETER				=> '缺少参数',
			self::SELECT_TABLE_FAILED				=> '查询数据库失败',
			self::IVLALID_TIME_FORMAT				=> '时间格式不正确',
			self::INVALID_USER_ID					=> '无效的user_id',

	    
	);

	static function errorMessage($errorCode)
	{
		if(isset(self::$arrErrorMessage[$errorCode])) {
			return self::$arrErrorMessage[$errorCode];
		} else {
			return "未知错误码";
		}
	}
}

?>
